package gui.gui2d.eventsmanager;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

public class ServersPanel extends JPanel{
	JList<String>j;
	DefaultListModel<String>dlm;
	public ServersPanel() {
		dlm= new DefaultListModel<String>();
		j= new JList<String>(dlm);
		JScrollPane jsp= new JScrollPane(j);
		add(jsp);
		JButton jb= new JButton("add");
		jb.addMouseListener(new MouseListener() {
			
			@Override
			public void mouseReleased(MouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mousePressed(MouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mouseExited(MouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mouseEntered(MouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mouseClicked(MouseEvent arg0) {
				dlm.addElement("ciao");
				
			}
		});
		add(jb);
	}
	
	
	
	
	
	public static void main(String[] args) {
		ServersPanel s= new ServersPanel();
		s.start();
	}
	
	
	
	
	
	void start(){
		JFrame prova= new JFrame();
		
		prova.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		prova.setVisible(true);
		prova.setSize(800, 600);
		ServersPanel s = new ServersPanel();
		prova.add(s);
	}
}
